<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<title>Send Alert</title>
</h:head>
<f:view>
	<h:body>
		<ui:composition template="../includes/template.xhtml">
			<ui:define name="mainbody">
				<center>
					<h:form>
						<p:panel id="panel" header="Send Alert" style="min-height: 550px"
							styleClass="prime_panel">
							<center>
								<p:growl id="growl" showDetail="true" sticky="false"
									autoUpdate="true" showSummary="false" />

								<table border="0" cellpadding="4px" cellspacing="8px">

									<tr>
										<td><h:outputText value="Subject :" />
											<h:outputText value="*" style="color:red" />
										</td>
										<td><p:inputText id="subject" size="50"
												value="#{alertBean.subject}" required="true"
												requiredMessage="Please enter the Subject of Alert" /></td>
									</tr>

									<tr>
										<td><h:outputText value="Message :" />
											<h:outputText value="*" style="color:red" />
										</td>

										<td><p:inputTextarea id="desc" rows="10" cols="50"
												value="#{alertBean.message}" required="true"
												requiredMessage="Please enter your Message" />
										</td>
									</tr>

									<tr>
										<td></td>

										<td colspan="2"><h:outputLabel>Select Recipients:</h:outputLabel>
											<h:outputText value="*" style="color:red" /> <p:pickList
												id="usersList" value="#{alertBean.reciepients}" var="user"
												iconOnly="true" itemValue="#{user}"
												converter="userConverter" required="true"
												requiredMessage="Please enter atleast 1 Reciepient">

												<f:facet name="sourceCaption">All Users</f:facet>
												<f:facet name="targetCaption">Send to</f:facet>

												<p:column style="font-size:12px">
										            #{user.name} - #{user.email}
										        </p:column>

											</p:pickList></td>
									</tr>


									<tr>
										<td></td>
										<td style="text-align: right"><p:spacer width="5" /> <p:commandButton
												id="submitButton" value="Send" type="submit" ajax="false"
												action="#{alertBean.action}" /></td>
									</tr>
								</table>

								<p:blockUI block="panel" trigger="submitButton">  
						        Sending Alert ...<br />
									<br />
									<p:graphicImage value="../../images/loading.gif" />
								</p:blockUI>

							</center>
						</p:panel>
					</h:form>
				</center>
			</ui:define>
		</ui:composition>
	</h:body>
</f:view>
</html>
